/*
 * @LastEditors: yuSeen
 * @LastEditTime: 2022-01-09 13:45:48
 */
import React, { memo, useEffect, useState } from "react";
import SongList from "./components/SongList";
import Swiper from "./components/Swiper";
import { getBanner } from "@/service/api/recommendMusic/recommendMusic";
import type { IBanner } from "@/service/api/recommendMusic/types";

interface IRecommendProps {}

const Recommend: React.FC<IRecommendProps> = memo((props) => {
  const [bannerList, setBannerList] = useState<IBanner[]>([]);

  useEffect(() => {
    (async () => {
      const { banners } = await getBanner();
      setBannerList(banners);
    })();
  }, []);

  return (
    <div className="recommend flex-col-c">
      {
        bannerList.length && <Swiper list={bannerList} />
      }
      <SongList />
    </div>
  );
});

export default Recommend;
